import cv2
from PIL import Image


def resizeimg(img_path, width, height, save_path):
    img = cv2.imread(img_path, 1)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    img_full_name = img_path.split("/")[-1]
    resize_img = cv2.resize(img, (width, height), )
    resize_img = Image.fromarray(resize_img)
    img_full_name = f'{width}X{height}' + img_full_name
    resize_img_path = f'{save_path}/{img_full_name}'
    resize_img.save(resize_img_path)
    return resize_img_path


if __name__ == '__main__':
    resizeimg("../humanseg_output/result_deeplab.jpg", 200, 200, '../resized')
